﻿Imports System.IO
Imports iTextSharp
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Public Class PdfGen
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button_Click(sender As Object, e As EventArgs) Handles Button.Click
        Response.ContentType = "application/pdf"
        Response.AddHeader("Content-Disposition", "attachment; filename=itext.pdf")

        Dim doc As New Document
        PdfWriter.GetInstance(doc, Response.OutputStream)
        doc.Open()
        doc.Add(New Paragraph("Add the contacts"))
        doc.Close()
    End Sub
End Class